package org.jeecg.modules.rabbitmq.consumer;

//import com.rabbitmq.client.*;

//import java.io.IOException;

public class Consumer {
//    private final static String QUEUE_NAME = "simple_queue";
//
//    public void consumeData()throws Exception{
//
//        ConnectionFactory factory = new ConnectionFactory();
//        factory.setHost("localhost");
//
//        try (Connection connection = factory.newConnection();
//             Channel channel = connection.createChannel()) {
//            channel.queueDeclare(QUEUE_NAME, false, false, false, null);
//
//            DefaultConsumer consumer = new DefaultConsumer(channel) {
//                @Override
//                public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
//                    String message = new String(body, "UTF-8");
//                    System.out.println("Received message: " + message);
//                }
//            };
//            // 开始消费消息
//            channel.basicConsume(QUEUE_NAME, true, consumer);
//            while (true) {
//                Thread.sleep(1000);
//            }
//        }
//    }
}
